package com.mind.system.domain;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson2.JSON;
import com.mind.common.annotation.CheckDuplicate;
import com.mind.common.annotation.Excel;
import com.mind.common.utils.StringUtils;
import com.mind.system.domain.vo.Field;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * 对象(AjObject)
 *
 * @author makejava
 * @since 2024-07-11 17:40:11
 */
@Data
@Schema(description = "对象管理")
public class AjObject implements Serializable {
    /**
     * 主键
     */     
    @ExcelIgnore
    private Integer id;
    /**
     * 原单类型
     */     
    private String type;
    /**
     * 名称
     */     
    @Excel(name = "名称")
    @ExcelProperty("名称")
    @CheckDuplicate(table = "aj_object", message = "对象名称 %s 已存在")
    @Schema(description = "名称")
    private String name;
    /**
     * 布局类型
     */     
    private String rowFormat;
    /**
     * 附件类型
     */     
    @Excel(name = "附件类型")
    @ExcelProperty("附件类型")
    @Schema(description = "附件类型")
    private String attachCate;

    private String fields;

    @Excel(name = "单据类型")
    @Schema(description = "单据类型")
    private String ticketType;
    /**
     * 创建时间
     */     
    @ExcelIgnore
    private Date createTime;
    /**
     * 更新时间
     */     
    @ExcelIgnore
    private Date updateTime;

    private Long sourceId;
    /**
     * 对象字段
     */
    @Excel(name = "对象字段")
    @ExcelProperty("对象字段")
    private List<Field> fieldList;

    @Schema(description = "附件分类-多个以逗号隔开")
    private String attachType;
    @Schema(description = "nc类型Id")
    private String ncScenarioid;
    @Schema(description = "分类名称")
    private String typeName;
    @Schema(description = "是否参与分类：0-否 1-是")
    private String isType;
    @Schema(description = "分类描述")
    private String typeDesc;
    private String ext1;
    private String ext2;
    private String ext3;
    private String ext4;
    private String ext5;
    private String ext6;
    private String ext7;
    private String ext8;
    private String ext9;
    private String ext10;

    public void setFields(String fields) {
        this.fields = fields;
        if(StringUtils.isNotEmpty(fields)) {
            this.fieldList = JSON.parseArray(fields, Field.class);
        }
    }
}

